Script hello
    PrintLn("hello world"); 
EndScript

Script ToX

PrintLn(StrToX("123", "U4"));
PrintLn(StrToX("123", "F8"));
PrintLn(StrToX("1212","U8"));

PrintLn(StrToX("Hello", "I4"));		//this will cause exceptionw

EndScript

Script time
PrintLn(StrTime("Date time in 24 hours format %Y/%M/%D %h:%m:%s.%S %A"));
PrintLn(StrTime("Date time in 12 hours format %Y/%M/%D %H:%m:%s.%S %a"));
PrintLn(StrTime("%1 %2 %3 %4 %5"));
PrintLn(StrTime("%1 %2 %3 %4 %5", 2)); //note the zero values int
EndScript


Script strwritefile
String s = "xxx";
if (StrAppendFile(s, "S3.txt"))
{
	PrintLn("Failed to write file");
}
else
{
	PrintLn("Write is successful");
}
EndScript


Script updateSlotTime
(value)

EndScript

Script updateCarrierTime
(value)

EndScript


Script test123
	U0 i = 5;
	if(i)
	{
		PrintLn("12");
		
	}
	else
	{
		PrintLn("21");
		
	}
EndScript


Script TestWhile
	U4 x;
	x = 0;
	
	while(x < 5)
	{
		PrintLn("x is ",x);
		if(x == 3)
		{
			wnext;
		}
		PrintLn("Before next");
	}
	{
		PrintLn("Inside next block");
		Inc(x);
	}

EndScript

Script test
	String s;
	U2 x;
	PrintLn(StrConvertHex(s, "00 0A 06 0B"));
	PrintLn(s);
	
	
	// String pattern2 = "ts*";
	// String target = "ts-1L-1T";
	// StrReplace(pattern2, "#", "@");
	// StrReplace(target, "#", "@");
	// PrintLn(pattern2);
	// PrintLn(target);
	
	// PrintLn(Pattern(target, pattern2));
		
	// 	if (Pattern(target, pattern2))
	// 	{
	// 		PrintLn("1212");
			
	// 	}
	
EndScript



Script hex
String s;
if (StrConvertHex(s, "500A B"))
{
	PrintLn("Failed to convert");
}
else
{
	PrintLn(StrHex(s));	
}

if (StrConvertHex(s, "5 A B 00"))
{
	PrintLn("Failed to convert");
}
else
{
	PrintLn(StrHex(s));
}
EndScript

Script t9
	U0 a = 0;
	if(!a)
	{
		PrintLn("1");
		
	}
	else
	{
		PrintLn("0");
		
	}
EndScript

Script Init_PG
    U4 ret;
    LibLoad("qpg.dll", "qpg", ret);
    PrintLn(ret);
    if (ret)
    {
        PrintLn("[PG] Init failed to load");
    }
    else
    {
        PrintLn("[PG] Init OK");
    }
EndScript

Script test1111
String tmp;
I4 ret;
Vector v;
StrAssign(tmp, "select water_mark from rtd.wcs_station_port_base_cfg where station_port = '0#-10UT-1O'");
ret = ExecuteSelect(tmp, v);
PrintLn(v);
EndScript

Script testupdate
Object objStmt;
I4 ret;
String tmp, s;
ObjCreateEx(objStmt, "CStatement");
U0 water_mark = 76767;
test1111();
objStmt.Update("water_mark", water_mark);
tmp = objStmt.GetUpdate("rtd.wcs_station_port_base_cfg", StrAssign(s, "station_port = '0#-10UT-1O'"));

ret = Execute(tmp);
if (ret)
{
	AppLog("[Error] Execute failed\x0A", tmp);
}
test1111();
EndScript